import { reqGetHomeList } from '@/api/product/home'

const state = {
  homeList: []
}

const actions = {
  async getHomeList({ commit }) {
    const result = await reqGetHomeList()
    if (result.code === 20000) {
      commit('SAVE_HOME_LIST', result.data)
    }
  }
}

const mutations = {
  SAVE_HOME_LIST(state, homeList) {
    state.homeList = homeList
  }
}

export default {
  namespaced: true,
  state,
  actions,
  mutations
}
